package Magnitudes;

import java.text.DecimalFormat;

public abstract class Money extends Magnitude {

	public String toString() {
		String retorno = formateoNumerico((this.amount));
		retorno = String.valueOf(this.symbol) + retorno;
		return retorno;
	}

	/*
	 * public String toString(){ String retorno =
	 * (this.symbol)+(String.valueOf(this.amount)); return retorno; }
	 */

	public double amount() {
		return this.amount;
	}

	public String formateoNumerico(double valorDouble) {
		DecimalFormat decimalFormat;
		String total = "";
		if (valorDouble < 1) {
			decimalFormat = new DecimalFormat("#,###0.00");
			total = decimalFormat.format(valorDouble);
		} else {
			decimalFormat = new DecimalFormat("#,###.00");
			total = decimalFormat.format(valorDouble);
		}
		return total;
	}

}
